/*  
 *  Copyright RobOtter (2008) 
 * 
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/** \file hposition_manager.h
  * \author JD
  *
  * Transform encoders information to absolute position.
  */

#ifndef HPOSITION_MANAGER_H
#define HPOSITION_MANAGER_H

#include "hrobot_system.h"


typedef struct hposition_manager
{

  hrobot_system *hrs;
  
  //________________________

  double phys_radius;

  //________________________

  // x position in meters
  double x_position;

  // y position in meters
  double y_position;

  // angle in radians
  double a_position;

  //________________________  
  // DEBUG

  double last_v1,last_v3, last_v5;

}hposition_manager;


/** \brief Zero structure */
void hpm_init(hposition_manager* hpm);

/** \brief Read encoders value and update position */
void hpm_update(void* data);


/** \brief Set hrobot system to use */
void hpm_set_related_hrobot_system(hposition_manager* hpm, hrobot_system* hrs);

/** \brief Set robot physical parameters 
  *  TODO parameters has to be defined  TODO
  */
void hpm_set_physical_parameters(hposition_manager* hpm, double radius);


/** \brief Set position */
void hpm_set(hposition_manager* hpm, double x, double y, double a);

/** \brief Return x position in meters */
double hpm_get_x(hposition_manager* hpm);

/** \brief Return x position in meters */
double hpm_get_y(hposition_manager* hpm);

/** \brief Return angle in radians */
double hpm_get_a(hposition_manager* hpm);

#endif/*HPOSITION_MANAGER_H*/
